<?php 
if($shop->CurrentOrder->getId() > 0)
{ 
	$dibs = new PaymentDIBS(); 
	if($shop->CurrentOrder->getPaymentTransact() > 0)
	{
		$dibs->validateOrder($shop->CurrentOrder);
		if($shop->CurrentOrder->getPaymentStatus() == 1)
		{ require('complete.php'); }
	}
	else
	{
		if(!($shop->CurrentOrder->getPaymentStatus() > 0))
		{
			$dibs->AcceptURL = SITE_URL.'plugins/payment/dibs_accept.php?c='.$katana->getComID().'&edit=payment&ad='.$shop->CurrentOrder->getAdId();
			$dibs->CancelURL = SITE_URL.'plugins/payment/dibs_cancel.php?c='.$katana->getComID().'&edit=payment&ad='.$shop->CurrentOrder->getAdId();
			$dibs->CallbackURL = SITE_URL.'plugins/payment/dibs_callback.php?c='.$katana->getComID().'&edit=payment&ad='.$shop->CurrentOrder->getAdId();
			$dibs->ComId = $katana->getComID();
			
			$orderfile = $dibs->prepareOrder($shop->CurrentOrder);
			echo '<h3>Preparing Payment</h3>';
			if(file_exists(ORDERS_PATH.$orderfile))
			{ 
			?>
				<form id="payform" name="payform" method="post" action="<?php echo SITE_URL; ?>plugins/payment/dibs_paywindow.php?order=<?php echo $shop->CurrentOrder->getId(); ?>">
				<?php require_once(ORDERS_PATH.$orderfile); ?>
				</form>
			<?php    
			}
			?>
			<script type="text/javascript">
				jQuery("#payform").submit(); 
			</script>
			<?php 
		}
	}
}
?>